package com.example.kingweather.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.kingweather.R;
import com.example.kingweather.bean.WeatherBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class WeatherListViewAdapter extends BaseAdapter {

    private Context context;
    private List<WeatherBean.HeWeather6Bean.DailyForecastBean> list;
    private List<WeatherBean.HeWeather6Bean.LifestyleBean> list2;

    public WeatherListViewAdapter(Context context, List<WeatherBean.HeWeather6Bean.DailyForecastBean> list, List<WeatherBean.HeWeather6Bean.LifestyleBean> list2) {
        this.context = context;
        this.list = list;
        this.list2 = list2;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        ViewHolder holder = null;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.list_view_item_weather, null);
            holder = new ViewHolder(view);
            view.setTag(holder);
        }else {
            holder= (ViewHolder) view.getTag();
        }

        if(i==0){
            holder.timeTextItem.setText("今天");
//            holder.airTextItem.setText(list2.get(i).);

        }else if(i==1){
            holder.timeTextItem.setText("明天");
        }else if(i==2){
            holder.timeTextItem.setText("后天");
        }



        return null;
    }

    static
    class ViewHolder {
        @BindView(R.id.time_text_item)
        TextView timeTextItem;
        @BindView(R.id.weather_image_item)
        ImageView weatherImageItem;
        @BindView(R.id.tmp_text_item)
        TextView tmpTextItem;
        @BindView(R.id.air_text_item)
        TextView airTextItem;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
